package cate.common.table.call.row;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cate.common.table.item.hero.StarGroupList;
import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteField;

public class CallBaseRow extends ERow {
    @NoteField(value = "召唤类型")
    public int callType;
    @NoteField(value = "召唤模式")
    public byte callMode;
    @NoteField(value = "召唤次数")
    public int callTimes;
    @NoteField(value = "VIP要求")
    public int vipLimit;
    @NoteField(value = "消耗道具ID")
    public int costPropId;
    @NoteField(value = "消耗道具数量")
    public int costPropNum;
    @NoteField(value = "消耗友情点")
    public String costFriendStr;
    @NoteField(value = "消耗召唤积分")
    public int costScoreNum;
    @NoteField(value = "消耗元宝")
    public String costM1Str;
    @NoteField(value = "免费刷新间隔")
    public int refreshInterval;
    @NoteField(value = "免费次数上限")
    public int freeMax;
    @NoteField(value = "奖励召唤积分")
    public int rewardScore;
    @NoteField(value = "元宝送经验")
    public String rewardExpStr;
    @NoteField(value = "星组配置")
    private String groupConfig;
    @NoteField(value = "双卡")
    public boolean duplicate;

    @NoteField(value = "防脸白机制")
    public boolean defendMark;

    @NoteField(value = "最多五星次数")
    public int limitFive;

    @NoteField(value = "替换星组")
    public int replaceGroup;


    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("召唤类型");
        this.callType = this.id;
        this.callTimes = xrw.getInteger("召唤次数");
        this.callMode = xrw.getByte("召唤模式");
        this.vipLimit = xrw.getInteger("VIP要求", 0);
        this.costPropId = xrw.getInteger("消耗道具ID", 0);
        this.costPropNum = xrw.getInteger("消耗道具数量", 0);
        this.costFriendStr = xrw.getString("消耗友情点");
        this.costScoreNum = xrw.getInteger("消耗召唤积分", 0);
        this.costM1Str = xrw.getString("消耗元宝");
        this.refreshInterval = xrw.getInteger("免费刷新间隔", 0);
        this.freeMax = xrw.getInteger("免费次数上限", 0);
        this.rewardScore = xrw.getInteger("奖励召唤积分", 0);
        this.rewardExpStr = xrw.getString("元宝送经验");
        this.duplicate = xrw.getBoolean("双卡", false);
        this.groupConfig = xrw.getString("星组配置");
        this.defendMark = xrw.getBoolean("获得五星限制开启", false);
        this.limitFive = xrw.getInteger("召唤五星次数上限",999);
        this.replaceGroup = xrw.getInteger("替换星组",4);
    }

    @JsonIgnore
    public StarGroupList config = new StarGroupList();

    @Override
    public void decode() {
        config.parse(groupConfig);
    }
}
